<%--
  Created by IntelliJ IDEA.
  User: 凡人
  Date: 2021/11/15
  Time: 11:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.2.1.js" rel="script"></script>
    <script src="${pageContext.request.contextPath}/static/My97DatePicker/WdatePicker.js" rel="script"></script>
</head>
<body>
    <form action="./add" method="post">
        订单编号:<input type="text" readonly="readonly" name="orderId" value="${l}">
        订单日期:<input type="text" readonly="readonly" name="orderDate" onclick="WdatePicker()"><br>
        客户名称:<input type="text" name="client">
        联系人:<input type="text" name="linkman">
        联系电话:<input type="text" name="tel"><br>
        优先级:<select name="rank">
                <option value="">请选择</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
            </select>
        送货地址:<input type="text" name="site"><br>
        制单人工号:<input type="text" name="preparedId">
        制单人:<input type="text" name="preparedBy">
        制单时间:<input type="text" readonly="readonly" name="preparedDate" onclick="WdatePicker()"><br>
        总金额:<input type="text" name="orderPrice">
        附件:<input type="file" name="file" id="file" onchange="upFile(this)">
            <div id="pic"></div>
        备注:<input type="text" name="content"><br>
        <input type="submit" value="提交">
    </form>
</body>
<script>
    function upFile(obj){
        var formData = new FormData();
        formData.append("file",obj.files[0]);
        $.ajax({
            url:"upFile",
            type:"post",
            data:formData,
            processData:false,
            contentType:false,
            success:function(url){
                $("#pic").html("");
                $("#pic").append("<input type='hidden' name='image' value='"+ url +"'>");
                $("#pic").append("<img src='"+ url +"' width='50px' height='50px'>");
            }
        })
    }
</script>
</html>
